Major refactoring.

One test is passing. Beware this commit!

Working on authorization code grant.