Added debug functionality.