Code factoring and css optimizing