made DRYing of the code, added new methods for getting entity and bundle types.