Readjustment of code and program

made some rewrites to my script and coding.