minimization working. writing coordinates not