Refactoring the code in Coach.php