Refactoring of AI to allow for improvements to be made