Extracted checks to functions