Refactoring of identifier resolution v2