Adding Error Handling