Style restructuring and removal of unused styles