working code on results page