initial import
numerous changes
full rewrite