Refactored and added a method