restructuring into external controller