More specific error handling
Better default error messages, refactor error message code