some cleanup and better handling of members and inheritance