Fixed issue where maxChoices=0 did not mean unlimited

Also some small code cleanup