Fixed refactoring mistakes