Fixed bug in getting team list for players with multi-word names

Also cleaned to code up a bit for readability.