Refactoring check functions to enable reuse