read the file in a new thread to avoid blocking the main thread