Adding useful function from legacy code.