fix #637 clean up

Changed multiple ifs to if else