Added IOException Handling