Improved the use of JS for header