OCaml implementation of ph2thomas/coop