change initialize and add retry function(no limit to number of times)