errors in js file
refactoring complete