Completing file IO functionality and slight API change