get refactor working, add --debug cli option