Refactor PrimPath analysis function
Refactor primary variable analysis