Adding stuff to see how well the refine_direction function works