optimize middle3