refacted to js files, still need to fix indentation, pull request practice
Merge pull request #1 from bgando/master

refacted to js files, still need to fix indentation, pull request pract