rename elements and cleanup