Separated sql calls for each sensor
Final small changes