some debug code, still very little testing