Refactor stock up code.