Fix some rather basic programming errors (for example, you must first declare a class before you can inherit from it...)