added some server side and client side validation