A functional version.