Fixing a bug with numbers such as 2211111. Also added comment about the problem I'm solving.