Rewrite 'rename' to use applicative style.