Error code refactoring