Improved flirt function, used a standard file