added new class to clean up code and make it more modular/encapsulated