Validation functionality added..correctly this time.