Refactor some handling of the sign in form