Item loading performance improvements, memory usage reduction and some small fixes.

See the commits for details.