modified main to work with monitorfile