Code modified . Definations for some variables have been included