Implements 'multiinsert-r' and 'multisubst' funcions