removed unnecessary shutdown code
refactoring some variable names and methods