first complete for main function