refactoring for redirect flow
URLs stored as objects not strings
tidied up various methods