refactor the css and javascript