more refactoring to make disassembler more general