Reimplement search, todo: fix style and clear useless js