Improvements to logic and for SDC7 compatibility.