storing results to db refactored
merge conflict fixed