Refactoring test and Fixing logout strategy