Define proper ctor and dtor for dcmsq objects, and use them.
Various cleanups and fixes. New test for dcmsq.