wrap db call in main