Move domain-specific code to isolated functions; use dictionary to pair loadImages functions with domains.