Added a "debug mode". Quite hackish still.