Removed unused variables and improved console output for ps script