work version without plots
add plot dependence