Added angle calculation based on direction.