Use mongoid instead of activerecord, little fixes and cleanups.