update merge function to accept an Array of Hashes as last argument

Each Hash in the Array is merged into separately and all the results are
returned in an Array. If the last argument is a Hash, the previous
behaviour is preserved.