Use OP_CODESEPARATOR

This code actually incorporates the OP_CODESEPARATOR behavior that is in the docs and cleans up a lot of dependency injection code (removes some factories, fixes law of demeter violations).

Unfortunately it includes a partial multisig implementation since this was part of a big rebase but I'll have to leave it in for now.