Updated logic for debugging and some graphical displays