Reorganize code after changing database, part 2 (do not use)