Initial OCaml implementation