Update 19

Re-making the Upgrade framework. Added more comments. Slight
optimizations.