Various improvements to the AI