move callFactory into separate function