Oauth2

Merging in OAuth2 implementation and various fixes