put search in a method - todo: recussive search
must check why states dont seem to be getting replaced