updated samples, added better error handling to server