flags added, oauth2 support added