changed if to else if