More refactoring and CS added