updated to support mongoid