Cleaning up datasource and plot to be more general