add scope parameter 

and better logging set-up