removed indmap. fixed bugs involving pop not updating the array it was popping from, so the algorithm now terminates.