Bugfix index calculation

Off by one for index calculations
Move to 256 values grayscale fingerprint
Refactor
Add script to while loop in index