More thorough unit testing and CS Fixes