Main: Avoid opening file every time.