selection.insert() now accepts function as second parameter