error check on the server
tighten error checking on client side; make naming more consistent; remove unused code