u/jbosch/DM-1188

Changes here are just to adapt to changes in shapelet, though it also allowed me to simplify some code here now that the functionality is available in the shapelet package.