refactor custom.js