re-factoring classes.js