Changes to login, added basic structure for manual sync of dirty data