Update error handling to return the standardized error codes

This closes #26