diff --git a/minimongo/model.py b/minimongo/model.py
index <HASH>..<HASH> 100644
--- a/minimongo/model.py
+++ b/minimongo/model.py
@@ -237,5 +237,7 @@ def to_underscore(string):
     >>> to_underscore('FooBar')
     'foo_bar'
     """
-    return re.sub(r'(.)([A-Z][a-z]+)', r'\1_\2', string).lower()
+    new_string = re.sub(r'([A-Z]+)([A-Z][a-z])', r'\1_\2', string)
+    new_string = re.sub(r'([a-z\d])([A-Z])', r'\1_\2', new_string)
+    return new_string.lower()
 
diff --git a/minimongo/tests/test_utils.py b/minimongo/tests/test_utils.py
index <HASH>..<HASH> 100644
--- a/minimongo/tests/test_utils.py
+++ b/minimongo/tests/test_utils.py
@@ -25,6 +25,8 @@ def test_to_underscore():
     assert to_underscore('fooBar') == 'foo_bar'
     assert to_underscore('FooBar42') == 'foo_bar42'
     assert to_underscore('Foo42Bar') == 'foo42_bar'
+    assert to_underscore('FOOBar') == 'foo_bar'
+    assert to_underscore('fooBAR') == 'foo_bar'
 
 
 def test_configure():
Fixed a bug and added a test case for to_underscore. Wasn't taking into account camel case words with acronyms. ( MongoDBRef = mongo_db_ref )
added test FOOBar and fooBAR.