udpated control code