Implement subclassing. (Only partially tested so far)