made generic
loops avoided and times enumerator added