Refactor argument check method