Added support for cooling

Very ugly code, but it works.