Fixing login redirect.
Some cleanup.