Refactor check number directive