refactors guess method