move reparene code into model