Fixed minor issue where only 1/2 of markers were removed at a time

Hello, 

This is a fix for an issue where the for-loop counter was being incremented while the array was being spliced at the same time. The result was that only 1/2 of the markers were being removed during the for-loop. 

Thanks for sharing this code!

Michael