Refactor the input test
Refactor R scripts
Refactor the python code
Corrected some small bugs
Minor changes