Foundations of legal research and writing