Added more complex search phase code.
Merged conflict.