improved the heading functions