Started refactoring ws-cs.js
Merge pull request #1 from martensms/master

Code refactoring by martensms