Clean up element.js code