Added debug information.
PROBLEM: removal of elements takes too much memory; logical index needed.