Refactoring and some bugs fixed.
Merge branch 'master' of https://github.com/ging/vish into storyrobin