use Reflection to determine the filename of a class (thx @stof), various
minor code tweaks