Adding class and inheritance and cleaning up