Improve course tags logic