Added c() in custom entity, its mostly CB code with a few modifications