Code Cleanup, more tests