changed selfupdate method to use recursive replacement