Minor refactor of debugging functions.