Copy pasted frontend.js from frontend branch