Ai code cleanup for final build