Fixed code to validate