refactored pkg controller updgrade functions