Removed some unreachable code and fixed another misnamed variable