Refactor detail.js
Add filtering feature