apply few optimizations