Add option to take distance instead of depth