Added code for file IO