Added a debug print function and cleaned up the formatting