Updated with data validation.