separating database code into separate modules, preparing to integrate main page