Fixed #8: enhanced form validation