Implement calculateHeadings