re-structuring control logic to new class