added if statements to view template