changed an if to an else if