improved Max's AI Method