async method to deal with database query delay. with help from hiroshi
mod
fixed tests
added more tests
Merge branch 'master' into hiroshi