more refactoring in get-courses.php