rework validations and error handling