Added pre_upgrade and post_upgrade funcs