enhance the loadArray method and wrote some unit tests