improved dateslider function and added some comments