Major login refactor
Major login refactor part 2