compacted L indexing
moved test outside loop in mul