adds pre-upgrade hook, cleans up indentation, and adds try catch around main require