updated time prediction code