Beginning rewrite; not totally runnable