Added debug functionality