work on #183; refactoring; fix; output