Refactored and further streamlined OAuth process