Massive rewrite with better separation.