updating EntityManager to use Rc<RefCell>>