Some optimizations in JS, disected index page to use PHP includes