fixed a memory leak
Added very simple type introspection mechanism. TODO: Update all documentation to reflect this newsystem.