better validation and more tests