allow a cfg object to be passed as parameter