mainpg cleanup