took if statements out of html in templates folder. made a rest class in app.py