Refactor to more go-ish API