Exception handling and refactor following the DRY principle.