moved all SQL queries into single Database module

Looks like there are other changes, like removing the lazy loading flag?