diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..f642106070e28720590bd6fa0040ef049ebb6dfd
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,19 @@
+rvm:
+  - 1.8.7
+  - 1.9.2
+  - 1.9.3
+gemfile:
+  - Gemfile
+  - gemfiles/Gemfile.mongoid-2.4.x
+env: SSL_CERT_DIR=/etc/ssl/certs
+matrix:
+  exclude:
+    - rvm: 1.8.7
+      gemfile: Gemfile
+      env: SSL_CERT_DIR=/etc/ssl/certs
+    - rvm: 1.9.2
+      gemfile: Gemfile
+      env: SSL_CERT_DIR=/etc/ssl/certs
+    - rvm: 1.9.3
+      gemfile: gemfiles/Gemfile.mongoid-2.4.x
+      env: SSL_CERT_DIR=/etc/ssl/certs
diff --git a/Gemfile b/Gemfile
index 19d94cd403d32dfc5cec981f86b8c87bede53a43..b114997e63766aaffb45ad5066df769b59516390 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,7 +5,11 @@ gemspec
 group :development, :test do
   gem 'rake'
   gem 'mongoid'
-  gem 'bson_ext'
+  gem 'bson_ext', :platforms => :ruby
 
   gem 'rails'
-end
\ No newline at end of file
+
+  platforms :jruby do
+  	gem 'jruby-openssl'
+  end
+end
diff --git a/README.rdoc b/README.rdoc
index c358029477d2e30ffe7c9f0e55ec340daeed9a54..c4c96667554071c6a1a705417e3ac8d2e2070df2 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -441,7 +441,7 @@ Mongo document classes (Mongoid and MongoMapper) have a built-in +near+ scope, b
 
 === Latitude/Longitude Order
 
-Coordinates are generally printed and spoken as latitude, then logitude ([lat,lon]). Geocoder respects this convention and always expects method arguments to be given in [lat,lon] order. However, MongoDB requires that coordinates be stored in [lon,lat] order as per the GeoJSON spec (http://geojson.org/geojson-spec.html#positions), so internally they are stored "backwards." However, this does not affect order of arguments to methods when using Mongoid or MongoMapper.
+Coordinates are generally printed and spoken as latitude, then longitude ([lat,lon]). Geocoder respects this convention and always expects method arguments to be given in [lat,lon] order. However, MongoDB requires that coordinates be stored in [lon,lat] order as per the GeoJSON spec (http://geojson.org/geojson-spec.html#positions), so internally they are stored "backwards." However, this does not affect order of arguments to methods when using Mongoid or MongoMapper.
 
 To access an object's coordinates in the conventional order, use the <tt>to_coordinates</tt> instance method provided by Geocoder. For example:
 
diff --git a/gemfiles/Gemfile.mongoid-2.4.x b/gemfiles/Gemfile.mongoid-2.4.x
new file mode 100644
index 0000000000000000000000000000000000000000..e3fe031df45723a395a423308638b979b3ccac30
--- /dev/null
+++ b/gemfiles/Gemfile.mongoid-2.4.x
@@ -0,0 +1,15 @@
+source "http://rubygems.org"
+
+gemspec :path => '..'
+
+group :development, :test do
+  gem 'rake'
+  gem 'mongoid', '2.4.11'
+  gem 'bson_ext', :platforms => :ruby
+
+  gem 'rails'
+
+  platforms :jruby do
+    gem 'jruby-openssl'
+  end
+end
diff --git a/lib/generators/geocoder/config/templates/initializer.rb b/lib/generators/geocoder/config/templates/initializer.rb
index 0401d015895507530bd4545573d9f3c6c0de8357..7f41a2714274da568bfd260576da349f9e4b0973 100644
--- a/lib/generators/geocoder/config/templates/initializer.rb
+++ b/lib/generators/geocoder/config/templates/initializer.rb
@@ -1,4 +1,4 @@
-Geocoder.configure do
+Geocoder.configure do |config|
   ## Configurable parameters: if you wish to change some configurable
   ## behaviour in Geocoder, feel free to uncomment the following lines
   ## and provide custom parameters.
diff --git a/lib/geocoder/lookups/base.rb b/lib/geocoder/lookups/base.rb
index 6c80e5ec8f44597ad8bde7e9c096ddffb8a26993..fddf8a0d4f3dcbe5fe64c2ae530e164c18c3337c 100644
--- a/lib/geocoder/lookups/base.rb
+++ b/lib/geocoder/lookups/base.rb
@@ -1,4 +1,5 @@
 require 'net/http'
+require 'net/https'
 require 'uri'
 
 unless defined?(ActiveSupport::JSON)
diff --git a/lib/geocoder/models/mongoid.rb b/lib/geocoder/models/mongoid.rb
index a7124e5bfd0681c36de543f90d96f52911c096c0..9e0b9fd832127dcf2439a06786d78658d7fc9e40 100644
--- a/lib/geocoder/models/mongoid.rb
+++ b/lib/geocoder/models/mongoid.rb
@@ -17,8 +17,14 @@ module Geocoder
       def geocoder_init(options)
         super(options)
         if options[:skip_index] == false
-          index [[ geocoder_options[:coordinates], Mongo::GEO2D ]],
-            :min => -180, :max => 180 # create 2d index
+          # create 2d index
+          if (::Mongoid::VERSION >= "3")
+            index({ geocoder_options[:coordinates].to_sym => '2d' }, 
+                  {:min => -180, :max => 180})
+          else
+            index [[ geocoder_options[:coordinates], '2d' ]],
+              :min => -180, :max => 180
+          end
         end
       end
     end
diff --git a/lib/geocoder/results/yandex.rb b/lib/geocoder/results/yandex.rb
index 841da9887e1c074699960caffa886b2ca0e76f70..bbcf9974b319374ffc368bfc584a873b9e2f51e3 100644
--- a/lib/geocoder/results/yandex.rb
+++ b/lib/geocoder/results/yandex.rb
@@ -57,6 +57,10 @@ module Geocoder::Result
       address_details['Locality']['Premise']['PremiseName']
     end
 
+    def precision
+      @data['GeoObject']['metaDataProperty']['GeocoderMetaData']['precision']
+    end
+
     private # ----------------------------------------------------------------
 
     def address_details
diff --git a/test/calculations_test.rb b/test/calculations_test.rb
index ee18f8361e464162cd36b7b3064d3bc8ae7bac4d..4f9fef0df46df8131fb82d67bd7f9b93e61f68d8 100644
--- a/test/calculations_test.rb
+++ b/test/calculations_test.rb
@@ -152,24 +152,24 @@ class CalculationsTest < Test::Unit::TestCase
 
   def test_extract_coordinates
     result = Geocoder::Calculations.extract_coordinates([ nil, nil ])
-    assert_equal [ Geocoder::Calculations::NAN ] * 2, result
+    assert is_nan_coordinates?(result)
 
     result = Geocoder::Calculations.extract_coordinates([ 1.0 / 3, 2.0 / 3 ])
     assert_in_delta 1.0 / 3, result.first, 1E-5
     assert_in_delta 2.0 / 3, result.last, 1E-5
 
     result = Geocoder::Calculations.extract_coordinates(nil)
-    assert_equal [ Geocoder::Calculations::NAN ] * 2, result
+    assert is_nan_coordinates?(result)
 
     result = Geocoder::Calculations.extract_coordinates('')
-    assert_equal [ Geocoder::Calculations::NAN ] * 2, result
+    assert is_nan_coordinates?(result)
 
     result = Geocoder::Calculations.extract_coordinates([ 'nix' ])
-    assert_equal [ Geocoder::Calculations::NAN ] * 2, result
+    assert is_nan_coordinates?(result)
 
     o = Object.new
     result = Geocoder::Calculations.extract_coordinates(o)
-    assert_equal [ Geocoder::Calculations::NAN ] * 2, result
+    assert is_nan_coordinates?(result)
 
     def o.to_coordinates
       [ 1.0 / 3, 2.0 / 3 ]
diff --git a/test/mongoid_test.rb b/test/mongoid_test.rb
index 0cc6b93a40b1ae9727d65a95c6dee88b43450339..1af5e9cd56e64d617b0e0fcee676de9b14925e16 100644
--- a/test/mongoid_test.rb
+++ b/test/mongoid_test.rb
@@ -17,7 +17,8 @@ class MongoidTest < Test::Unit::TestCase
   def test_custom_coordinate_field_near_scope
     location = [40.750354, -73.993371]
     p = Place.near(location)
-    assert_equal p.selector[:location]['$nearSphere'], location.reverse
+    key = Mongoid::VERSION >= "3" ? "location" : :location
+    assert_equal p.selector[key]['$nearSphere'], location.reverse
   end
 
   def test_model_configuration
diff --git a/test/mongoid_test_helper.rb b/test/mongoid_test_helper.rb
index 572db2b985bfb12bd0861845f3df088cb5cf5680..cf37bb01c236fb9b6df27b81f39bcbed5884e1a2 100644
--- a/test/mongoid_test_helper.rb
+++ b/test/mongoid_test_helper.rb
@@ -7,8 +7,12 @@ require 'geocoder/models/mongoid'
 $LOAD_PATH.unshift(File.dirname(__FILE__))
 $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
 
-Mongoid.configure do |config|
-  config.logger = Logger.new($stderr, :debug)
+if (::Mongoid::VERSION >= "3")
+  Mongoid.logger = Logger.new($stderr, :debug)
+else
+  Mongoid.configure do |config|
+    config.logger = Logger.new($stderr, :debug)
+  end
 end
 
 ##
diff --git a/test/test_helper.rb b/test/test_helper.rb
index f0c1dbfec8bcbdf097527335dbf8f450ed04a650..61b1d058fdf2e6031d4c1087b5b62e2173f50d2f 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -271,5 +271,11 @@ class Test::Unit::TestCase
   def street_lookups
     all_lookups - [:freegeoip]
   end
+
+  def is_nan_coordinates?(coordinates)
+    return false unless coordinates.respond_to? :size # Should be an array
+    return false unless coordinates.size == 2 # Should have dimension 2
+    coordinates[0].nan? && coordinates[1].nan? # Both coordinates should be NaN
+  end
 end