Delete mainfunction