Updated after refactoring