modified to work with latest dark