Reformat JS code style and refactor some JS pieces
Fix initial emptiness bug
Merge pull request #11 from killthekitten/fix-initial-emptiness

Fix initial emptiness