Improve PID and logging
improve logging