Minor code performance improvements

Accessing an objects components is slower than storing that component in a variable and accessing that. The CompareTag function is also faster than using the operator.