Performance improvement.

This code uses only one assignment statement and hopefully without breaking anything else.