need to reverse the basket so that the sorting of unknown items isn't reversed

because push adds to beginning and the loop starts at the beginning as well.
move cache cleanup to set-cache-file function
more create new local item stuff in merge-local