added turn detection