Converted some `switch..case` statements to `if..else if` to appease JSLint