Change check state mapping from if/then to case statement.