Rewrite outpost code