Added target resolving code