Refactored argument length checking