adding debug functionality