optimized the transition between views