Changes to Advanced Search to make it robust
Fixed merge conflicts