Code for new res functionality
Documented and working result file.