factor out the pool allocation logic into its own thing