changed if to when

ended up with a underdetermined system
Reverted some of Shashank's changes