improved typesystem and debugging