MAINT: grammatical fix
MAINT: replaced nested for loop with itertools.product
MAINT: code reduction
ENH: readability and other improvements based on feedback from @ebolyen and @wasade