working version with autorizations