removed switch statement using if statements