Moved control logic into control class