lots of changes to design and code
merged result
minor changes to the merged version