Make everything work with ranges, make duration and repeat_delay work