improving the optimization process for emagefit