Many improvements.

Tried to implement function soft-typing as well, but figured out that
the current framework won't be able to support that.