Added Error Checking for Dictionary