added input form, sanitizing, and socket error handling