Lots of changes and additions.

bulk of the prototype is finished.