moved the debug stuff into its own class