cleaning up impl of loadData()