Cleaned up the index function by adding a separate helper loadTestRecords method.