solved State excercise (except the unintelligable isHappy function)