split out config a bit more
added logging and changed cookie reading