refactored with oauth