refactored stock update