turning algorithm applied