Fixed new user signin bug reported by Ed, plus handful of tweaks and
some code cleanup.