Pass length of array as parameter.
Moved the builing of image meta data to own file
Moved the builing of image meta data to own file