search, code cleanup