Minor improvement to the generic functions.