Refactored to DRY up argument length checks

@sosedoff Just thought I would contribute by reducing the duplication when checking argument length. :smile: