Code cleanup
More tests