Fix JavaScript Bugs and Improve Search Behaviour