added some debug functionality