Cleaning up auth code, add $state redirects