Added threading and subprocess to monitor script