you write `if (debug) println` so many times, that it would really be beneficial if you extract this pattern to a separate method `log` so that we can use this for logging globally, rather than sprinkling this through the code everywhere.