Finally advanced search is working fully (I hope)