created flip flop switch and functionality based on if/statements