nFold function

Common argument