status/error refactoring