Code refactoring [index & login]