changed if to case statement