some changes in text and diagramms and logic