Refactors caller identifiying code and removes warnings for comparing against possibliy unset values