added support for multiple targets and varying interval lengths