Clean up code style and refactory
Fix bug get sign out link in test environment