Fix client-side validation after testing. Add more error codes.