I don't like this method very much. The if-else combined with an iteration seems a bit wonky for some reason, but I don't have a better idea off hand.