renamed direction function