Refactored code and css