use a more intuitive pattern for collecting enum ids

This is more functional in spirit, and probably easier to pick up.