2nd stage of overhaul. Needs expression templating added.