Optimize the frontpage to not query the entire db.

  Fixes #187.