some cleanup, but most importantly this fixes a bug in android browsers that would not pass along authentication credentials normally.