moved error stuff into its own controller