fix issue with Else and slightly refactor login