open file only once, it makes it faster