moved if statement from view into this file to make html file look cleaner