Migrated the readData method from assignment3