Made the data fetching less greedy
Moved clearing, for sake of logic