cleaned up if statements to call functions outside of the if statements