Improve efficiency.

Same change as my other pull request. Please view it for more information.