Optimize some Linq.