partial impl of adoption agency algorithm