first revision of working turn code