added debug functionality