refactory js and css