moved item generation to its own function, other subtle elegance