         replaceStats: replaceStats
     )
 
+  # replaces pseudonyms with ids in a list
   pseudonymListToIdList = (plist) ->
     rdb.expr(plist).map((p) -> rdb.table("Users").getAll(p,index:"pseudonym").nth(0)("id"))
 
+  # replaces ids with pseudonyms in a list
   idListToPseudonymList = (idlist) ->
     idlist.map((id) -> rdb.table("Users").get(id)("pseudonym"))
 

utils = require './utils'

module.exports = (con, config) ->
  desensetizeGroupQuery = (query) ->
    query.merge((g) ->
      users: idListToPseudonymList g("users")

  desensetizeGroup = (query) ->
    desensetizeGroupQuery(query).run(con)

  # see desensetizeGroupQuery
  desensetizeGroups = (query) ->
    desensetizeGroupQuery(query).run(con)

  # create new group for a user
  createGroup = (user_id, group_users) ->
    rdb.do(
      pseudonymListToIdList(group_users),
