extract business logic from AI code