Revised assembler.

Attempted reduction of globals and coupling as well as improved clarity.