added server and client side validation