Refactored some methods into a new class