Two new functions????
Number will be written in json file
Added global vars
Correct some bugs