Rewrite pool to use two arrays