Tests are added. AI is fixed