Pool allocation moved to function.