typo with time ).
added file handling