Error Checking improved