refactor and tested Facebook login