Changed switch statements to use predefined constants.