Some Error Checking Added