async method to deal with database query delay. with help from hiroshi