fixed minor bugs associated with front page, separated out js file for layout