fixes an edge case where the call stack was maximised

- added more tests
- updated the docs
- removed minification from the test script