Separate AI and display code