if statements fixed nesting; passes through test1-7