Removed clones, unified validation, added tests.