Optimize some Linq.
Merge pull request #396 from Therzok/master

Optimize some Linq.