Added validation to main API method