Refactor the code under artificial_intelligence module.