updated control code and case switches