Major type and capabilities refactorings

- Reduces reliance on types package
- Brings common interfaces into core.go
- Returns internal *structs to users, which can be stored using provided interfaces
Added complete godoc (nicely complements refactor)