Reorganize code; add Search