Fix OAuth implementation.

Restructure codebase.