Made improvement suggested by Brent.