Moved functions around, added basic google auth support.