More tests + bug fixes.