refactored code inside of thhe checking class