Refactor shopping, add tests