changed var scope so that line plots do not persist across queries