increased number of input digits for sof
commented some amount of code from github