Replaced _i and _j with _1 and _2. Fixed -Wall warnings