Add debugs to functions. Add pidfile_unlink().