Adding debug functionality