Added validation to the backend