The fact that you're dealing with a system that performs work by transferring heat means that it is theoretically impossible to get 100% efficiency out.
The fundamental limit is the Carnot limit:
nth≤1−TCTH
Where Tc is the temperature of the system where the heat is dumped (or rather, the ambient temperature) and This the heat of the engine. The only way to make it theoretically more efficient is to reduce the ambient temperature or to increase the engine temperature.
There are lots of other constraints such as friction, dumping energy as sound, dumping energy as a pressure release, etc. But even reducing these constraints to zero, it can never pass the Carnot limit.