code reformat
time calculation fixes + code reformat