reformatted to use pickle