Refactor to internal namespace, cleanup, docs, more tests