implemented query expansion puzzle