Shorten the case statement, remove useless test.