Adding Error Checking