Moved freeing expanded_hits to the loop where expanded_hits is created