Clean-up and update of CHECK(MULTI)SIG

Better handling of some non-standard transactions and refactoring.