MADE SOME CHANGES FROM COPYFILE