Refactoring more errors