Added better debugging facilities.