DRY up the argument error checking and use custom error types