started refactoring frontend js code