Add the beginnings of upgrade support.
Code pretty-ification, including better type declaration support