Complete re-write, better loot handling