Moving errors to phayes/errors for better error handling