Improve course enrollment logic