oops: must use a file, otherwise the while loop is runin another process and variables are lost