Added dependency resolving for self references