             wav_src.type = 'audio/wav'
             
             #assign proper srcs
-            if config.url.indexOf('.mp3') isnt -1
+            if @_config.url.match /.mp3$/
                 mp3_src.src = @_config.url
                 ogg_src.src = @_config.url.replace '.mp3', '.ogg'
                 wav_src.src = @_config.url.replace '.mp3', '.wav'
-            else if config.url.indexOf('.ogg') isnt -1
+            else if @_config.url.match /.ogg$/
                 ogg_src.src = @_config.url
                 mp3_src.src = @_config.url.replace '.ogg', '.mp3'
                 wav_src.src = @_config.url.replace '.ogg', '.wav'
-            else if config.url.indexOf('.wav') isnt -1
+            else if @_config.url.match /.wav$/
                 wav_src.src = @_config.url
                 mp3_src.src = @_config.url.replace '.wav', '.mp3'
                 ogg_src.src = @_config.url.replace '.wav', '.ogg'

            #request event handlers
            request.successCallback = (buffer) =>
                @_buffer = buffer
                if config.playOnLoad and Greenhorn.isRunning()
                    @play()
            request.errorCallback = ->
                throw new Error "AJAX request Error"

#end class Sound

#more natural alias for calling class methods
@Sounds = @Sound
