You have misassigned Xarthor's code a litte bit: The ent_remove should not be within the while loop, but right after it!