Build system improvements and cleanup