Refactored out a print_array method to make testing patterns easier