Modified for accepting process id and monitoring process.