use code from merge with uncertainty-visualisation branch