Added error codes to bad requests (Fixed #4)