Restructured database interation (made general and specific cases.