Correction of the functions
Add several debugging functions