Changed so APIHandler manages error messages correctly