update array set indexing transformation
and some tiny cleaning up.