Improved css class manipulation and test cases