dealing better with concurrency and adding quantity logic