Refactor check functions.