lots of changes. to be continued... going to undo a bit of this