fixed sampling time interval bug
minor changes, working version