added angle calculation and direction
added angle calculation