Updated code for links and images assignment