updated control code