Move safe collection logic to base class
Improve safeCollect