Improved the main js