satisfy linter
refactoring

- moved counter i and j into for each loop
- switched to using .format instead of + for concatination
fixed conflict