using norvig method and better logic