added stringToInt method and comments