Add functions from legacy code