Functional version of backend.