rewriting the program