Refactorized code, add Foursquare support