Item loading performance improvements and small fixes.

See the commits for details.