Alot of type signature cleanup, doc clarifications and added examples.
Fixes to bugs introduced in cleanup.