cs fixes and some code changes