code refactoring of JS side
Merge pull request #5 from nadavmatalon/refactorJS

code refactoring of JS side