refactoring a bunch of things, just learning rethinkdb