Bug to login

This has several changes required to move forward, and passes what we need it to. Move to merge.