transfrom short switch statements into readable if statements
refactor a bit for better readability