Conversion of heat energy into work