Using switch statement instead of long chains of ifs.