Moved pid_file location to common.pid_file, so we can use it in other places.
Rewrote some parts of the pidfile util.