Documentation

Rewrite internals, enable cover, fix dialyzer
Add doc target and some minor doc cleanups