Error checking improved.