Made into a class, refactored methods