Refactored init method to accept arbitrary replacement strings.