Added debug function 'debug' which can easily be disabled.