Cleanup and build system improvements