Simplify and clarify search
Fix some warnings from --pedantic