code refactoring of JS file