@wooduk, please check out my answer here. All you have to do is to replace my timeseries library name by your lib_name.
timeseries
lib_name