fix logic flaw in if statements should have just used a case statement