Major refactor to support multiplatform and heat.