Added API to help with debugging and implemented #8