debug implementation (still working)