working after refactoring