login stuff and restructuring