Refactored. Using devise and oauth for authentication