Handle inheritance
Almost finished inherintance handling. TODO added.