move stuff out of db callback (#123)