v2. Rewriten with new features and better code-readability.
More fixes for the new version.