Updated market function to clear market first, added buildStash function