Added optional file IO.