implemented search
some cleaning