Avoid `RangeError`s due to maximum call stack size

Thanks to @Yaffle!

Closes #1.