refactoring and moving home page js in to it's on file