kept the localize function more general