initial version.  still has extraneous code