Calculating vectors and direction