upgrade of querying database, modularization