moved purchase logic around