added reference file support