refactored index_to_heading method