Refactored 'check' task (to consist of reusable parts).