reorganizing some db actions