Reduce number of queries in home page

#311 to be merged first.