Refactor data.js