refactoring, using member function