Refactor projects.js