use case statement instead of multi if then else