Numerous micro-optimizations

Make note rendering faster.
Make sorting while lazy-loading work.