added client-side validation of data