added support for inheritance, unit tests