More clean-up and parameter validation.