Adapted to refactoring