refactoring to use instance method instead of static method