add rewrite() to use all globals