Fixed kibit issues.
Lots more changes, improvements, additions, unit tests.