Cleaned some unused var and other sonar reported problems