Removed unused variables and made xpath selectors more specific