Refactor entity for inheritance

Made it possible to inherit entity