a bunch of tweaks and some fixes.
Also fixed the failing tests.
Added another example.