trying to complete mainfunction