refractoring for twitter sign in