Do proper checks for return values
Pack data into arrays; Display JSON separate from building arrays