added client-side validation