added support for nested classes (untested)