Change error handling to store the error number rather than the string,