final version +DEBUG_MODE