39 login redirect

Fixed #39. And yes, some of the rebasing got messy.