CS fix and remove unused code