added openfile function