Rewrote much of the dcm code. Seems to work.