Removed idx variable so that courses are always either updated or added