Implementing inventory management.
Merging with Pratyusha's changes.