Refractoring And Prep Work for xAuth