Fix validations, add tests