added logic for selecting course