Updated Code for other conditions