After we compute density one can remove instabilities by checking for inversions and masking them. Most of the time those are due to CTD descending issue and/or not desired even when they are real features of the data (like when feeding the data to a numeric model.)