Refactors core package to provide clean interfaces and godoc