adds logging and cleans up files