optimize readfile function