remove an extra loop
change if/else approach to switch