Added function finddirection