fixed previous refactoring