Moved course deletion prompt code to a function