refactored to genSensor() and plotSensor(). Added density.