added dependency detection when initializing variables