switching from if statement to case statement for simpler syntax