adds logic for errors on homepage and results page