Rewrite for pacman 4.1