Add database storage for inventories
Code cleanup