Made the removing of entities work to some extent