Marking entities about to be removed, avoiding multiple removal

I've had some weird behavior, as some of my entities got removed multiple times at times.
This code helps to avoid this. I guess you could do this from the users code with flags, but it seems such a basic feature.