More login logic, closes #6