making some adjustments, more safety on clock backwards, pass additional params like pid