Fold this into the general function as well if possible.