changed time interval from double to long