replace time.time() with now(), and some cleaning