         db.close()
         after if results.length is 1 then results[0] else false
 
-  find: (table, params, after = ->) ->
+  find: (table, params, options, after) ->
+    if isFunction params
+      after   = params
+      params  = null
+      options = {}
+
+    if isFunction options
+      after   = options
+      options = {}
+
+    after   = (->) if not after
+    options = {}   if not options
+
     @getInstance table, (db, collection) ->
       try
         params._id = ensureObjectId params._id if params?._id?


ensureObjectId = (id) ->
  if typeof id is 'string' then new ObjectID id else id

class EasyMongo
  constructor: (@options) ->

        db.close()
        return after []

      cursor = collection.find(params)

      cursor.sort  options.sort  if options.sort
      cursor.limit options.limit if options.limit
      cursor.skip  options.skip  if options.skip

      cursor.toArray (error, results) ->
        console.log 'Error with fetching documents: ' + error if error

        db.close()
