adding some logic to the results page