Moved errors to their own module. Not sure what to do with all the special cases though.