rename files and add timeout function