added state = 3 condition