final version - checked for validation errors