moved all the input/output for array and image to a new file