Small performance improvements

Commit messages are self-explanatory.