switched from if-statement to switch