major rework to allow nested tool calls