- Rewritten and fixed
- Added unit tests