Change Pooling Function to Support Several Samples