Worked on intermittent RES implementation. More or less working version.