added additional sql queries
merge with master
Merge branch 'master' into richard-test