More API and build system work; type cleanup needed.