procedural rewrite (add function)