Added better protection code to category changes if the spreadsheet is re-read during category loops.
Updated some comments.