CS fixes and code clean up.