added guess handling logic