Fixed validation return object and handle errors better