CR changes: use simple if instead of switch