Custom Records and Debug

Added a new "onDebug" property and some debug info. Progress on the
custom records feature. Still not functional, but I found a way to solve
it.