Generic parallel for