private void clearEntities() {
        for (int i = 0; i < entities.size(); i++) {
            Entity e = entities.get(i);
            if (e.isRemoved()) {
                entities.remove(i);
            }
        }
    }