Helper comments

I added a bunch of comments, removed some unused code,

Some minor undefined fixes

removed the old upgrade helper.