copy the way that scalardist does it