Smoother invalid argument errors, and removed dead code paths