Opcode converter working

fixed opcode converter. and made the function more compact. Updated
comments.