Implemented following changes :

1. Make use of chaining in elem.remove().text()
2. Used method hasClass instead of inArray.
3. Find the input search element by selector and not by ID.