working on fixing issues with multiple images. cleaning up code a little