Cleanup unused code.
Fix duplicate error code.