add debug_mode capabilities
reorganise methods