fixed API (pubkeys for multisig, etc.); rearranged some function args