Chop up spaghetti code and stuff it into methods
Add condition "if course"

e.g. course is only deleted from array if there IS a course