Added joins and simplified the inheritance - still work in progress...