utility code for creating types, event handling, working with inheritance etc.