add debug options
refactor