Refactoring + CS fixes + typo