Improved param and error handling.