Make search button work + js rewrite