Small CS fix and refactoring