What is the function of a flywheel in IC engines?