Added comments and a logfile
Made the interval a variable and removed the control characters in favor of a logfile