much rewriting underway

some TODOs left to resolve