move db reader to separate file