Added new class and cleaned up the code.