refactor of Material.js