diff --git a/lib/sinatra/mongo.rb b/lib/sinatra/mongo.rb
index <HASH>..<HASH> 100644
--- a/lib/sinatra/mongo.rb
+++ b/lib/sinatra/mongo.rb
@@ -16,15 +16,15 @@ module Sinatra
     end
 
     def mongo
-      url = URI(mongo_url)
-      connection = Mongo::Connection.new(url.host, url.port)
-      @mongo ||= begin
-                   mongo = connection.db(url.path[1..-1])
-                   if url.user && url.password
-                     mongo.authenticate(url.user, url.password)
-                   end
-                   mongo
-                 end
+      @mongo ||= (
+        url = URI(mongo_url)
+        connection = Mongo::Connection.new(url.host, url.port)
+        mongo = connection.db(url.path[1..-1])
+        if url.user && url.password
+          mongo.authenticate(url.user, url.password)
+        end
+        mongo
+      )
     end
 
     protected
don't instantiate a new connect on each reference