Replaced if with case

Because bash is the devil ;)