Added a direction function