moved shared code into aux.ml