fully functional script, currently updating test file instead of real file