wrote most of  rename()