use tags for pool allocations, and reformat code