Moved error classes to where they are used. Closes #77.