Made some global variable as local variables

Made some global variable as local variables and add some semi colons