created an add image function that replaces a lot of code.