mapsubst with join, trim and other util functions.