remoted some debugging code from NeuroPy