added some functions and constants for more friendly debugging, although the code for it is not friendly