refactor of debugging APIs