added index in inventory script for performance improvement