Better solution to working on a local file