Fixed bug in _build_structure()
Changing name of 'file' attribute to 'filename' since this makes it clearer that it is the filename and not a file object