let insert_after l element reference =
    let rec aux acc = function
      | [] -> raise Not_found
      | hd :: tl ->
          if hd = reference
          then rev_append acc ( hd :: element :: tl )
          else aux ( hd :: acc ) tl
    in aux [] l