CGO clean up and better lib organization