this is the controlFunction