Rename main class
Kill using $this->pid and not $pid
dirname fixes for paths