Refactored the code to have a separate function forn printing arrays of data.