                 )
 
 
-class @Fontana.datasources.TwitterSearchFA
+class @Fontana.datasources.TwitterSearchFA extends @Fontana.datasources.TwitterSearch
     ###
-    Same as the Twitter search datasource with changes:
+    Same as the Twitter search datasource but allows:
     -- Different twitter api url
     -- Uses an authenticated http service passed in,
      such as an authenticated OAuth.io response, but others with the correct headers set should work as well
     ###
-    min_interval = 60000 * 15 / 180
-
-    constructor: (@q, @res)->
-        @params = {
-            since_id: 1
-            q: @q
-            result_type: 'recent'
-        }
-        @lastCall = 0
-        @messages = []
-
-    getMessages: (callback)->
-        now = (new Date()).getTime()
-        if now - @lastCall < min_interval
-            if callback
-                setTimeout((=> callback(@messages)), 0)
-        else
-            @lastCall = (new Date()).getTime()
-            @res.get(
-                url: "https://api.twitter.com/1.1/search/tweets.json" 
-                data: @params
-                dataType: 'json')
-                    .success((data)=>
-                        if data.statuses.length
-                            @messages = data.statuses.concat(@messages)
-                            @params['since_id'] = @messages[0].id_str
-                        if callback
-                            if @messages.length
-                                callback(@messages)
-                            else
-                                callback([
-                                    id: (new Date()).getTime()
-                                    created_at: new Date().toString()
-                                    text: 'Your search term returned no Tweets :('
-                                    user:
-                                        name: 'Twitter Fontana'
-                                        screen_name: 'twitterfontana'
-                                        profile_image_url: '/img/avatar.png'
-                                ])
-                    )
-                    .error(->
-                        if callback
-                            callback([
-                                id: (new Date()).getTime()
-                                created_at: new Date().toString()
-                                text: 'Error fetching tweets :('
-                                user:
-                                    name: 'Twitter Fontana'
-                                    screen_name: 'twitterfontana'
-                                    profile_image_url: '/img/avatar.png'
-                            ])
-                    )
-
+    constructor: (@q, @http, @url)->
+        super(@q)
+        if !@url?
+            @url = "https://api.twitter.com/1.1/search/tweets.json"
+        @getJSON = @http.get(            
+            url: @url
+            data: @params
+            dataType: 'json')
        }
        @lastCall = 0
        @messages = []

    getMessages: (callback)->
        now = (new Date()).getTime()

                setTimeout((=> callback(@messages)), 0)
        else
            @lastCall = (new Date()).getTime()
            @getJSON
                .success((data)=>
                    if data.statuses.length
                        @messages = data.statuses.concat(@messages)
