added sorting to inventory_elements