Switch to errors library and tidy parameter handling