finish the main part