Add most of the execute function.