refactoring css and code to make it more modular