Improved loot function.